# Python 2.6.4
# Project Euler, Problem 77
# Copyright 2010 Talha Zaman

from mine import sieveprimes
lim = 101
sv = sieveprimes(lim)
prsum = [0]*lim
prsum[0] = 1
for i in range(len(sv)):
    for j in range(sv[i], lim):
        prsum[j] += prsum[j-sv[i]]
print min(x for x in range(lim) if prsum[x]>5000)
